Post

Replies

Boosts

Views

Activity

SwiftUI does not manage two NavigationLinks in a single list row
There seems to be a problem with placing multiple NavigationLinks on a List item row in SwiftUI. If I have two links on the same row and tap one of them, SwiftUI seems to create a path using both links. Irrespective of which of the two is tapped, the view specified by the first (left-hand) appears. Tapping Back reveals the view specified by the second (right-hand) link. Tapping again returns to the list. This problem has been mentioned before in relation to Buttons. The solution offered was to use button styles, and make sure the button areas do not overlap (how could they overlap?). This does not work ChatGPT gave me a clear example, which it claimed would work, but just demonstrates the problem import SwiftUI struct ContentView: View { var body: some View { NavigationView { List { ForEach(0..<10) { index in HStack { NavigationLink(destination: DestinationView1(item: index)) { Text("Navigate to View 1") .padding() .background(Color.blue) .foregroundColor(.white) .cornerRadius(8) } .buttonStyle(PlainButtonStyle()) // Ensure the link only activates on its area Spacer() NavigationLink(destination: DestinationView2(item: index)) { Text("Navigate to View 2") .padding() .background(Color.green) .foregroundColor(.white) .cornerRadius(8) } .buttonStyle(PlainButtonStyle()) // Ensure the link only activates on its area } .padding(.vertical, 5) } } .navigationBarTitle("Navigation Links") } } } struct DestinationView1: View { var item: Int var body: some View { Text("Destination View 1 for item \(item)") .navigationBarTitle("View 1", displayMode: .inline) } } struct DestinationView2: View { var item: Int var body: some View { Text("Destination View 2 for item \(item)") .navigationBarTitle("View 2", displayMode: .inline)
6
0
893
May ’24
Home app unreliable across network with iOS 18 beta and Sequoia beta
I have installed iOS 18 beta on one iPhone and Sequoia beta on one computer. Other phones and computers are running iOS 17 and Sonoma. Siri now frequently responds with "I'm having trouble... " or "Some accessories are not responding . ". I have the Home app's Home page open on my Mac. It alternates between two versions of my HomeKit setup. In one version I have several scenes (Good Morning, Goodnight, Go to work) configured and it shows correctly that some lights are on. In the other version there are no scenes and everything thing is reported as "No Response". The display switches between versions very few minutes. It seems to me that Home is referencing two versions of truth in my network. I have tried turning off the two devices running beta OSs
0
1
228
Jun ’24